package com.ok.api.client.fallback;

import com.ok.api.client.IntegralClient;
import com.ok.api.client.UserClient;
import com.ok.api.domain.po.OkAddr;
import com.ok.api.domain.po.OkUser;
import com.ok.common.domain.po.Result;
import com.ok.common.exception.CustomException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @ClassName UserFallback
 * @Description UserFallback远程调用失败处理
 * @Author hw
 * @Date 2024/5/12 22:36
 */
@Slf4j
public class UserFallback implements FallbackFactory<UserClient> {
    @Override
    public UserClient create(Throwable cause) {

        return new UserClient() {
            @Override
            public Result<OkUser> info(@RequestParam Long id) {
                log.error("远程调用UserClient#info方法出现异常");
                return null;
            }

            @Override
            public Result<OkAddr> infoAddr(Long id) {
                log.error("远程调用UserClient#info方法出现异常");
                return null;
            }
        };
    }
}
